package de.msg.scjpbook.chapter3;

public class DeadCode {

	public void run() {

		if (false) {
			System.out.println("Dead code");
		}

		if (!true) {
			System.out.println("Dead code");
		}

		int i;
		// i++; // The local variable i may not have been initialized
		if (true) {
			i = 0;
		}
		i++;

		if (!(2 != 3)) {
			System.out.println("Dead code");
		}

		if (!(2 == 2)) {
			System.out.println("Dead code");
		}

		if (!("As" == "As")) {
			System.out.println("Dead code"); // Dead code
		}

		DeadCode g = new DeadCode();
		if (!(g == g)) { // Comparing identical expressions
			System.out.println("!(g==g)");
		} else {
			System.out.println("Compiler didn't know !(g==g) would be false.");
		}
		int j;
		if (g == g) { // Comparing identical expressions
			j = 2; // Compilier isn't sure whether this will be executed
		}
		// Compiler error on next line:
		// System.out.println(j); //The local variable j may not have been
		// initialized

		if (!(new Integer(2) == new Integer(2))) {
			System.out
					.println("(new Integer(2) == new Integer(2) sind unterschiedlich!!!!! Wo ist das Fliegengewicht pattern????????");
		} else {
			System.out
					.println("Compiler didn't know that new Integer(2)==new Integer(2) is always true. AND ITS NOT!!! It's false!!! Why? Isn't that Flyweight pattern?");
		}

	}

}
